package com.jt.safe.ui.adpter

import android.widget.TextView
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.jt.safe.R
import com.jt.safe.entity.CalendarBean

class SelectTimeAdapter :
    BaseQuickAdapter<CalendarBean, BaseViewHolder>(R.layout.select_time_item) {
    private var priceMap = mutableMapOf<String, String>()
    var list = arrayListOf<CalendarBean>()

    fun setPriceMap(priceMap: MutableMap<String, String>) {
        this.priceMap = priceMap
        notifyDataSetChanged()
    }

    override fun convert(helper: BaseViewHolder, item: CalendarBean) {
        val mTitle = helper.getView<TextView>(R.id.month_title)
        val month_recycler = helper.getView<RecyclerView>(R.id.month_recycler)
        month_recycler.layoutManager = GridLayoutManager(mContext, 7)
        val selectSubTimeAdapter = SelectSubTimeAdapter()
        selectSubTimeAdapter.setPriceMap(priceMap)
        selectSubTimeAdapter.setNewData(item.dateBeans)
        month_recycler.adapter = selectSubTimeAdapter
        mTitle.text = item.shownTitle
    }
}